<!-- when cypress is enabled this html will be copied to dist folder to use it for multiuser tests -->
<html style="height:100%"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Multiuser tests</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
</head>
<body>
    <form id="form1" action enctype="multipart/form-data" target="iframe1" method="post">
        <input name="access_token" value="test" type="hidden"/>
   </form>

    <form id="form2" action enctype="multipart/form-data" target="iframe2" method="post">
        <input name="access_token" value="test" type="hidden"/>
    </form>

    <iframe id="iframe1" name="iframe1" frameborder="0" scrolling="yes" style="height: 100%;
            width: 49%; float: left; " height="100%" width="49%" align="left">
    </iframe>

    <iframe id="iframe2" name="iframe2" frameborder="0" scrolling="yes" style="overflow: hidden; height: 100%;
                width: 49%; " height="100%" width="49%" align="right">
    </iframe>
    <script>
        function constructWopiUrl() {
            var wopiUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + "?";
            wopiUrl = wopiUrl.replace("cypress-multiuser.html", "cool.html");
            var params = new URLSearchParams(window.location.search);
            var filePath = params.get('file_path').substr(1);
            params.delete('file_path');
            var wopiSrc = window.location.protocol + "//" + window.location.host + "/wopi/files/" + encodeURIComponent(filePath);
            wopiUrl = wopiUrl + "WOPISrc=" + wopiSrc + '&' + params.toString();
            return wopiUrl
        }
       var wopiUrl = constructWopiUrl();
       var form1 = document.getElementById("form1");
       form1.action = wopiUrl
       form1.submit();

       var form2 = document.getElementById("form2");
       form2.action = wopiUrl
       form2.submit();
    </script>
</body>
</html>

